package distributedbank.snapshot;

import java.io.Serializable;

import distributedbank.util.CentsConverter;
/**
 * Detailed information on Transfer Request 
 * that sails between servers
 */
public class RequestInfo implements Serializable
{
	private static final long serialVersionUID = -7611486869766757982L;

	private int amount;

    private int srcBranchId;

    private int destBranchId;

    private int srcAcctId;

    private int destAcctId;

    private static String formatter = "Transferring %s from %d.%d to %d.%d";

    public RequestInfo( int amount, int srcBranchId, int destBranchId,
            int srcAcctId, int destAcctId ) {
        this.amount = amount;
        this.srcBranchId = srcBranchId;
        this.destBranchId = destBranchId;
        this.srcAcctId = srcAcctId;
        this.destAcctId = destAcctId;
    }
    
    /**
     * Convert the information to string.
     */
    public String toString() {
        return String.format( formatter, CentsConverter
                .getAmountInDollarsWithSign( amount ), srcBranchId, srcAcctId,
                destBranchId, destAcctId );
    }
}